import time

import allure
from page_base.page_base import Base
from page_object.page_lg_login import PageLogin

from page_element.el_lg import *
import logging
from faker import Faker



class Adduser(PageLogin):
    def page_adduser(self, name, phone,pwd):
        # 打开A3mall
        self.open_url(url)
        self.maximize_window()
        self.page_login('admin','123456')

        with allure.step(f"点击用户管理:"):
            self.click(user_page.usermanage_loc)
        with allure.step(f"点击用户信息:"):
            self.click(user_page.userinfo_loc)
        with allure.step("点击添加用户"):
            self.click(user_page.adduser_loc)
        with allure.step("输入用户名"):
            self.send_keys(user_page.username_input, name)
        with allure.step("输入手机号"):
            self.send_keys(user_page.phone_input,phone)
        with allure.step("输入登录密码"):
            self.send_keys(user_page.login_pwd_input,pwd)
        with allure.step("点击提交"):
            self.click(user_page.commit_loc)

        # 断言添加用户名
        dyusername = self.text(user_page.dy_username_one)
        assert dyusername == name



